﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.Modeling.CApSetEndModelingSimulationCmd
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using COMMANDPARAMSLib;
using System;
using System.Resources;
using System.Windows;
using Tecnomatix.Engineering;
using Tecnomatix.Engineering.Ui.WPF;


namespace DnProcessSimulateCommands.Modeling;

public class CApSetEndModelingSimulationCmd : ITxCommand, ITxExecutableCommand
{
  private const string RESOURCE_TABLE_PATH = "DnProcessSimulateCommands.Modeling.CApSetEndModelingSimulationStringTable";
  private TxCommandEnabler m_enabler = new TxCommandEnabler(true);
  private CoEndSetModelingSimulationParams m_cmdParam;

  public ITxCommandEnabler CommandEnabler => (ITxCommandEnabler) this.m_enabler;

  public bool Expose => false;

  public string Identifier => string.Empty;

  public bool Connect() => true;

  public void Disconnect()
  {
  }

  public void Execute(object cmdParams)
  {
    this.m_cmdParam = cmdParams as CoEndSetModelingSimulationParams;
    if (this.m_cmdParam == null)
      return;
    ((ICoEndSetModelingSimulationParams) this.m_cmdParam).ShouldContinue = Convert.ToInt32(this.ExecuteInternal());
  }

  private bool ExecuteInternal()
  {
    CApSetEndModelingApp.ShouldContinue = true;
    if (!TxApplication.ActiveDocument.SimulationPlayer.IsSimulationReset())
    {
      CUiSetEndModelingSimulationView wnd = new CUiSetEndModelingSimulationView();
      string str = CApSetEndModelingApp.ReadValueFromRegistry((TxWindow) wnd);
      if (str == null || str == "0")
        ((Window) wnd).ShowDialog();
    }
    return CApSetEndModelingApp.ShouldContinue;
  }

  private ResourceManager GetResourceManager()
  {
    return new ResourceManager("DnProcessSimulateCommands.Modeling.CApSetEndModelingSimulationStringTable", this.GetType().Assembly);
  }
}
